<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>my3d</title>
  <style>
    body{perspective: 500px;}
    .container{position: relative;width: 100px;margin: 100px auto; margin-bottom: 0;
    height: 30px;transform-style: preserve-3d;transition: all .5s;}
    .front,
    .bottom{position: absolute;width: inherit;height: inherit;text-align: center;line-height: 30px;}
    /* .front{background-color: teal;z-index: 99;} */
    .front{background-color: teal;z-index: 99; transform: translate3d(0,0,15px);}
    /* .bottom{background-color: blueviolet;transform: translate3d(0,30px,0) rotate3d(1,0,0,-90deg);
    transform-origin: top center;} */
    .bottom{background-color: blueviolet;transform:translate3d(0,15px,0) rotate3d(1,0,0,-90deg);}
    .container:hover{transform: rotate3d(1,0,0,90deg);}
  </style>
</head>
<body>
  <div class="container">
    <div class="front">js</div>
    <div class="bottom">html</div>
  </div>
</body>
</html>